import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import postcsspxtoviewport8plugin from 'postcss-px-to-viewport-8-plugin';
// https://vite.dev/config/
export default defineConfig({
  plugins: [react(),tailwindcss()],
  server: {
    proxy: {
      '/api': {
        target: 'http://123.60.213.46:8000/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
      '/addPay': {
        target: 'http://113.44.139.133:8005/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/addPay/, ''),
      },
    },
  },
  css: {
    postcss: {
      plugins: [
        postcsspxtoviewport8plugin({
          unitToConvert: 'px',
          viewportWidth: 375,
          unitPrecision: 3,
          propList: ['*'],
          viewportUnit: 'vw',
          fontViewportUnit: 'vw',
          selectorBlackList: ['.ignore', '.hairlines'],
          minPixelValue: 1,
          mediaQuery: false,
          replace: true,
          exclude: [/node_modules/],
          landscape: false,
          landscapeUnit: 'vw',
          landscapeWidth: 667
        })
      ]
    }
  }
})
